/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_HTTP_MEDIA_UT_H
#define MK_HTTP_MEDIA_UT_H
#include "MkHttpApi/MkHttpApi.h"
#include <gtest/gtest.h>

class CMkTimer;
class CMkEventPool;
class CMkHttpClient;

class CMkHttpTestServer : public CMkHttpApi
{
public:
    CMkHttpTestServer(CMkEventPool* pEventPool, CMkTimer* pTimer);
    ~CMkHttpTestServer();

private:
    Uint32 OnRequestJsonParse(const MkHttpMethod& Method, const MkString& Path, const MkMapString& MapQuery, const Json::Value& JsonReq, const MkHttpResponseJsonCb& cb) override;
    Uint32 OnWebSockekAccessed(CMkHttpSession* pSession) override;
protected:
private:
};


class CMkHttpApiUt : public testing::Test
{
public:
    void SetUp() override;
    void TearDown() override;

public:
    CMkTimer*           m_pTimer;
    CMkEventPool*       m_pEventPool;
    CMkHttpTestServer*         m_pHttpTestServer;
    Uint16              m_HttpPort;
    CMkHttpClient*      m_pHttpClient;
    void*               m_WaitHandle;
    MkMapString         m_MapHeader;

    CMkHttpClient*      m_pClient;
    CMkLock             m_ClienkLock;
    BOOL                m_bClientConnected;
};


#endif